package service;

import dao.MemberDao;
import entity.Member;
import entity.MemberGroup;
import org.springframework.beans.factory.annotation.Autowired;

import javax.transaction.Transactional;
import java.util.List;

/**
 * Created by jifeng on 2016/12/12 0012.
 */
@Transactional
public class MemberService {
    @Autowired
    private MemberDao memberDao;

    public MemberDao getMemberDao() {
        return memberDao;
    }

    public void setMemberDao(MemberDao memberDao) {
        this.memberDao = memberDao;
    }

    public Member addMember(Member member){
        memberDao.addMember(member);
        return member;
    }

    public Member updateMember(Member member){
        memberDao.updateMember(member);
        return  member;
    }
    public Member findMemberById(int id){
        return memberDao.findMemberById(id);
    }

    public List<MemberGroup> findMemberGroupList(){
        return memberDao.findMemberGroupList();
    }
    public void deleteMemberGroup(int id){
        memberDao.deleteMemberGroup(id);
    }

    public MemberGroup addMemberGroup(MemberGroup memberGroup){
        memberDao.addMemberGroup(memberGroup);
        return memberGroup;
    }

    public void updateMemberU(int id,String level){
        memberDao.updateMemberU(id,level);
    }
}
